<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simGetShapeViz</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simGetShapeViz" id="simGetShapeViz"></a>simGetShapeViz / sim.getShapeViz </h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Retrieves a shape's visual information.<br></td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simGetShapeViz(simInt shapeHandle,simInt index,struct SShapeVizInfo* info)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>shapeHandle</strong>: handle of the shape</div>
<div><strong>index</strong>: 0-based index of the shape element to retrieve (compound shapes contain more than one shape element)</div>
<div><strong>info</strong>: visual information about the shape:</div>
<div><br></div>
<div><strong>vertices</strong>: array of vertices, relative to the shape's reference frame. The user is in charge of releasing this buffer with <a href="simReleaseBuffer.htm">simReleaseBuffer</a> if the return value is &gt; 0.</div>
<div><strong>verticesSize</strong>: the size of the vertices array</div>
<div><strong>indices</strong>: array of indices. The user is in charge of releasing this buffer with <a href="simReleaseBuffer.htm">simReleaseBuffer</a> if the return value is &gt; 0.</div>
<div><strong>indicesSize</strong>: the size of the indices array</div>
<div><strong>normals</strong>: array of normals, relative to the shape's reference frame. There are 3*indicesSize normals, i.e. 3 normals per triangle. The user is in charge of releasing this buffer with <a href="simReleaseBuffer.htm">simReleaseBuffer</a> if the return value is &gt; 0.</div>
<div><strong>shadingAngle</strong>: the gouraud shading angle</div>
<div><strong>colors[9]</strong>: array of colors: RGB for ambient-diffuse,  specular, and  emission.</div>
<div><strong>texture</strong>: the RGBA texture (32bit/pixel). The user is in charge of releasing this buffer with <a href="simReleaseBuffer.htm">simReleaseBuffer</a> if the return value is &gt; 1.</div>
<div><strong>textureId</strong>: a texture id (to identify textures shared among several shapes)</div>
<div><strong>textureRes[2]</strong>: the resolution of the texture</div>
<div><strong>textureCoords</strong>: the texture coordinates. There are 3*indicesSize texture coordinates, i.e. 3 coordinates per triangle. The user is in charge of releasing this buffer with <a href="simReleaseBuffer.htm">simReleaseBuffer</a> if the return value is &gt; 1.</div>
<div><strong>textureApplyMode</strong>: 0=modulate, 1=decal, 2=add</div>
<div><strong>textureOptions</strong>: bit-coded:</div>
<div class=tab>bit0 set (1): repeat U</div>
<div class=tab>bit1 set (2): repeat V</div>
<div class=tab>bit2 set (4): interpolate colors</div>
<div class=tab>bit3 set (8): wireframe</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>-1 if operation was not successful, 0 if there is no shape element at the given indexm, 1 if the shape element does not contain any texture, 2 if the shape element contains a texture<br>
</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>map data=sim.getShapeViz(number shapeHandle,number index)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div><strong>shapeHandle</strong>: handle of the shape.</div>
<div><strong>index</strong>: 0-based index of the shape element to retrieve (compound shapes contain more than one shape element)</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div>In case of success, data contains following fields:</div>
<div><strong>data.vertices</strong>: array containing the  vertices, relative to the shape's reference frame</div>
<div><strong>data.indices</strong>: array containing the indices</div>
<div><strong>data.normals</strong>: array containing the normals, relative to the shape's reference frame</div>
<div><strong>data.colors</strong>: array containing the colors: RGB for ambient-diffuse,  specular, and  emission.</div>
<div><strong>data.shadingAngle</strong>: the gouraud shading angle</div>
<div><br></div>
<div>Additionally, if the shape element contains a texture, data contains following additional fields:</div>
<div><strong>data.texture.texture</strong>: the string-coded RGBA texture. See also <a href="simTransformBuffer.htm">sim.transformBuffer</a></div>
<div><strong>data.texture.id</strong>: a texture id (to identify textures shared among several shapes)</div>
<div><strong>data.texture.resolution</strong>: the resolution of the texture</div>
<div><strong>data.texture.coordinates</strong>: the texture coordinates</div>
<div><strong>data.texture.applyMode</strong>: 0=modulate, 1=decal, 2=add</div>
<div><strong>data.texture.options</strong>: bit-coded:</div>
<div class=tab>bit0 set (1): repeat U</div>
<div class=tab>bit1 set (2): repeat V</div>
<div class=tab>bit2 set (4): interpolate colors</div>
</td> 
</tr> 
</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
